package com.demo.common;

import lombok.*;

import java.io.Serializable;


@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ResponseData<T> implements Serializable {

    public static final String OK = "OK";

    @Getter
    enum ResponseCode {
        SUCCESS(1), FAIL(0);
        private int status;
        ResponseCode(int status) {
            this.status = status;
        }
    }

    private Integer status;

    private T data;

    public static <T> ResponseData success(T data) {
        return ResponseData.builder().status(ResponseCode.SUCCESS.getStatus()).data(data).build();
    }

    public static ResponseData success() {
        return ResponseData.builder().status(ResponseCode.SUCCESS.getStatus()).build();
    }



}
